<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%manual_pics_get_log}}".
 *
 * @property int $id
 * @property int $custom_id
 * @property string $req_data
 * @property int $created_at
 * @property string $resp_data
 * @property string $picid
 * @property string $error_msg 获取错误信息
 *
 * @property Custom $custom
 */
class ManualPicsGetLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%manual_pics_get_log}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['custom_id', 'created_at'], 'integer'],
            [['req_data', 'resp_data'], 'string'],
            [['picid'], 'string', 'max' => 20],
            [['error_msg'], 'string', 'max' => 200],
            [['custom_id'], 'exist', 'skipOnError' => true, 'targetClass' => Custom::className(), 'targetAttribute' => ['custom_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'custom_id' => Yii::t('app', 'Custom ID'),
            'req_data' => Yii::t('app', 'Req Data'),
            'created_at' => Yii::t('app', 'Created At'),
            'resp_data' => Yii::t('app', 'Resp Data'),
            'picid' => Yii::t('app', 'Picid'),
            'error_msg' => Yii::t('app', '获取错误信息'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCustom()
    {
        return $this->hasOne(Custom::className(), ['id' => 'custom_id']);
    }
}
